<?php 
defined('IN_TS') or die('Access Denied.');

switch($ts){

	case "":
		break;
		
	case "upload":
	
		$studyid = intval($_GET['studyid']);
	
		$videoid = $new['study']->create('study_video',array(
			'studyid'=>$studyid,
			'addtime'	=> date('Y-m-d H:i:s'),
		));
		
		//上传
		$arrUpload = tsUpload($_FILES['Filedata'],$videoid,'study/video',array('mp4'));
		
		if($arrUpload){

			$new['study']->update('study_video',array(
				'videoid'=>$videoid,
			),array(
				'title'=>$arrUpload['name'],
				'size'=>$arrUpload['size'],
				'path'=>$arrUpload['path'],
				'video'=>$arrUpload['url'],
			));
			
		}
		
		echo $videoid;
	
		break;

}

